<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Agents.aspx.cs" Inherits="Agents" Title="Project Monitoring System"
    Culture="auto:en-US" UICulture="auto" meta:resourcekey="PageResource1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"
    Visible="false">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <asp:ObjectDataSource ID="ODSAgent" runat="server" SelectMethod="GetAgentData" TypeName="IPTableAdapters.AgentTableAdapter"
        OldValuesParameterFormatString="original_{0}" DeleteMethod="Delete" InsertMethod="Insert"
        UpdateMethod="Update">
        <SelectParameters>
            <asp:SessionParameter DefaultValue="0" Name="SuperUser" SessionField="SuperUser"
                Type="String" />
            <asp:SessionParameter DefaultValue="" Name="OwnerGroupID" SessionField="OwnerGroupID"
                Type="String" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="Original_Agent" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="ChineseName" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="ContactPerson" Type="String" />
            <asp:Parameter Name="JobTitle" Type="String" />
            <asp:Parameter Name="Phone" Type="String" />
            <asp:Parameter Name="Fax" Type="String" />
            <asp:Parameter Name="Phone2" Type="String" />
            <asp:Parameter Name="MobilePhone" Type="String" />
            <asp:Parameter Name="MobilePhone2" Type="String" />
            <asp:Parameter Name="WebSite" Type="String" />
            <asp:Parameter Name="EmailAddress" Type="String" />
            <asp:Parameter Name="EmailAddress2" Type="String" />
            <asp:Parameter Name="UpdateBy" Type="String" />
            <asp:Parameter Name="ContactPerson2" Type="String" />
            <asp:Parameter Name="Fax2" Type="String" />
            <asp:Parameter Name="Original_Agent" Type="String" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="Agent" Type="String" />
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="ChineseName" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="ContactPerson" Type="String" />
            <asp:Parameter Name="JobTitle" Type="String" />
            <asp:Parameter Name="Phone" Type="String" />
            <asp:Parameter Name="Fax" Type="String" />
            <asp:Parameter Name="Phone2" Type="String" />
            <asp:Parameter Name="MobilePhone" Type="String" />
            <asp:Parameter Name="MobilePhone2" Type="String" />
            <asp:Parameter Name="WebSite" Type="String" />
            <asp:Parameter Name="EmailAddress" Type="String" />
            <asp:Parameter Name="EmailAddress2" Type="String" />
            <asp:Parameter Name="CreateBy" Type="String" />
            <asp:Parameter Name="UpdateBy" Type="String" />
            <asp:Parameter Name="OwnerGroupID" Type="String" />
            <asp:Parameter Name="ContactPerson2" Type="String" />
            <asp:Parameter Name="Fax2" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
    <asp:Panel ID="SearchPanel" runat="server">
        <fieldset style="width: 700px; text-align: center">
            <legend>
                <asp:Label ID="lblSearch" runat="server" Text="Search" meta:resourcekey="lblRoleResource1"></asp:Label></legend>
            <table align="left">
                <tr>
                    <td width="60" align="left">
                        <asp:Label ID="lblSearchAgent" runat="server" Text="Agent:" meta:resourcekey="lblAgentResource1"></asp:Label>
                    </td>
                    <td width="200" align="left">
                        <asp:TextBox ID="txtSearchAgent" runat="server"></asp:TextBox>
                    </td>
                    <td width="100" align="left">
                        <asp:Label ID="lblSearchChineseName" runat="server" Text="Chinese Name:" meta:resourcekey="lblChiNameResource1"></asp:Label>
                    </td>
                    <td width="100" align="left">
                        <asp:TextBox ID="txtSearchChineseName" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <asp:Label ID="lblSearchName" runat="server" Text="Name:" meta:resourcekey="lblNameResource1"></asp:Label>
                    </td>
                    <td align="left">
                        <asp:TextBox ID="txtSearchName" runat="server"></asp:TextBox>
                    </td>
                    <td align="left">
                        <asp:Label ID="lblSearchContactPerson" runat="server" Text="Contact Person:" meta:resourcekey="lblContactPersonResource1"></asp:Label>
                    </td>
                    <td align="left">
                        <asp:TextBox ID="txtSearchContactPerson" runat="server"></asp:TextBox>
                        <asp:Button ID="btnSearch" runat="server" Text="Search" CausesValidation="false"
                            meta:resourcekey="btnSearch" OnClick="btnSearch_Click" />
                    </td>
                </tr>
            </table>
        </fieldset>
    </asp:Panel>
    <table width="970px">
        <tr>
            <td align="center">
                <asp:Label ID="lblError" runat="server" ForeColor="Red" Width="100%" CssClass="error"
                    meta:resourcekey="lblErrorResource1"></asp:Label>
            </td>
        </tr>
    </table>
    <asp:Panel ID="GridPanel" runat="server" meta:resourcekey="GridPanelResource1">
        <table>
            <tr>
                <td align="right">
                    <asp:Button ID="btnNewAgent" runat="server" CausesValidation="False" CssClass="submit"
                        Text="New Agent" meta:resourcekey="btnNewAgentResource1" OnClick="btnNewAgent_Click" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:GridView CssClass="Grid" ID="GridView1" runat="server" DataSourceID="ODSAgent"
                        AutoGenerateColumns="False" BackColor="#DEBA84" BorderColor="#660000" GridLines="Both"
                        BorderStyle="Solid" BorderWidth="1px" CellPadding="0" CellSpacing="0" DataKeyNames="Agent,Name,ChineseName,Address,ContactPerson,JobTitle,Phone,Fax,Phone2,MobilePhone,MobilePhone2,WebSite,EmailAddress,EmailAddress2"
                        EmptyDataText="No Agent record(s) available." OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                        meta:resourcekey="GridView1Resource1" AllowPaging="True" PageSize="20" Width="970px"
                        OnPageIndexChanging="GridView1_PageIndexChanging" OnRowCommand="GridView1_RowCommand"
                        OnRowDataBound="GridView1_RowDataBound">
                        <FooterStyle CssClass="GridFooterStyle" />
                        <Columns>
                            <asp:ButtonField CommandName="Select" DataTextField="Agent" HeaderText="Agent" meta:resourcekey="ButtonFieldResource1"
                                Visible="false">
                                <ItemStyle HorizontalAlign="Left" Width="100px" Wrap="False" />
                            </asp:ButtonField>
                            <asp:TemplateField HeaderText="Agent" meta:resourcekey="ButtonFieldResource1">
                                <ItemTemplate>
                                    <a href="agentsupdate.aspx?Agent=<%# Eval("Agent")%>">
                                        <asp:Label ID="lblAgent" runat="server" Text='<%# Eval("Agent")%>'></asp:Label></a>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" Width="100px" Wrap="False" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="Agent" HeaderText="Agent" ReadOnly="True" SortExpression="Agent"
                                Visible="False" meta:resourcekey="BoundFieldResource1">
                                <ItemStyle HorizontalAlign="Left" Width="100px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" meta:resourcekey="BoundFieldResource2">
                                <ItemStyle HorizontalAlign="Left" Width="90px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="ChineseName" HeaderText="Chinese Name" SortExpression="ChineseName"
                                meta:resourcekey="BoundFieldResource3">
                                <ItemStyle HorizontalAlign="Left" Width="90px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address"
                                meta:resourcekey="BoundFieldResource4">
                                <ItemStyle HorizontalAlign="Left" Width="250px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="ContactPerson" HeaderText="Contact Person" SortExpression="ContactPerson"
                                meta:resourcekey="BoundFieldResource5">
                                <ItemStyle HorizontalAlign="Left" Width="120px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="JobTitle" HeaderText="JobTitle" SortExpression="JobTitle"
                                meta:resourcekey="BoundFieldResource6">
                                <ItemStyle HorizontalAlign="Left" Width="100px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" meta:resourcekey="BoundFieldResource7">
                                <ItemStyle HorizontalAlign="Left" Width="80px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Fax" HeaderText="Fax" SortExpression="Fax" meta:resourcekey="BoundFieldResource8">
                                <ItemStyle HorizontalAlign="Left" Width="80px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="CreateBy" HeaderText="CreateBy" SortExpression="CreateBy"
                                Visible="False" meta:resourcekey="BoundFieldResource9" />
                            <asp:BoundField DataField="CreateDate" HeaderText="CreateDate" SortExpression="CreateDate"
                                Visible="False" meta:resourcekey="BoundFieldResource10" DataFormatString="{0:d}" />
                            <asp:BoundField DataField="UpdateBy" HeaderText="UpdateBy" SortExpression="UpdateBy"
                                Visible="False" meta:resourcekey="BoundFieldResource11" />
                            <asp:BoundField DataField="UpdateDate" HeaderText="UpdateDate" SortExpression="UpdateDate"
                                Visible="False" meta:resourcekey="BoundFieldResource12" DataFormatString="{0:d}" />
                            <asp:BoundField DataField="OwnerGroupID" HeaderText="OwnerGroupID" SortExpression="OwnerGroupID"
                                Visible="False" meta:resourcekey="BoundFieldResource13" />
                            <asp:BoundField DataField="Phone2" HeaderText="Phone2" SortExpression="Phone2" Visible="False"
                                meta:resourcekey="BoundFieldResource14" />
                            <asp:BoundField DataField="MobilePhone" HeaderText="MobilePhone" SortExpression="MobilePhone"
                                Visible="False" meta:resourcekey="BoundFieldResource15" />
                            <asp:BoundField DataField="MobilePhone2" HeaderText="MobilePhone2" SortExpression="MobilePhone2"
                                Visible="False" meta:resourcekey="BoundFieldResource16" />
                            <asp:BoundField DataField="WebSite" HeaderText="WebSite" SortExpression="WebSite"
                                Visible="False" meta:resourcekey="BoundFieldResource17" />
                            <asp:BoundField DataField="EmailAddress" HeaderText="EmailAddress" SortExpression="EmailAddress"
                                Visible="False" meta:resourcekey="BoundFieldResource18" />
                            <asp:BoundField DataField="EmailAddress2" HeaderText="EmailAddress2" SortExpression="EmailAddress2"
                                Visible="False" meta:resourcekey="BoundFieldResource19" />
                            <asp:TemplateField HeaderText="Status" Visible="false" meta:resourcekey="ButtonFieldResourceStatus">
                                <ItemTemplate>
                                    <asp:Label ID="lblDeleted" runat="server" Text="Deleted" Visible="false" meta:resourcekey="lblDeletedResource"></asp:Label>
                                    <asp:Label ID="lblNormal" runat="server" Text="Normal" Visible="false" meta:resourcekey="lblNormalResource"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Restore" Visible="false" meta:resourcekey="BoundFieldResourceRestore">
                                <ItemTemplate>
                                    <asp:Label ID="lblIsDelete" runat="server" Text='<%# Eval("IsDelete") %>' Visible="false"></asp:Label>
                                    <asp:LinkButton ID="lbtnRestore" CommandName="Restore" runat="server" Text="Restore"
                                        meta:resourcekey="lbtnRestoreResource"></asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                        </Columns>
                        <RowStyle CssClass="GridRowStyle" />
                        <AlternatingRowStyle CssClass="GridAltRowStyle" />
                        <SelectedRowStyle CssClass="GridSelectedRowStyle" />
                        <PagerStyle CssClass="GridPagerStyle" ForeColor="White" />
                        <HeaderStyle CssClass="GridHeaderStyle" ForeColor="White" />
                    </asp:GridView>
                </td>
            </tr>
        </table>
    </asp:Panel>
    <br />
    <div style="padding: 5px; display: none;">
        <fieldset style="text-align: center">
            <div style="padding-top: 5px" />
            <table>
                <tr>
                    <td style="vertical-align: top; text-align: right; width: 137px;">
                        <asp:Label ID="lblAgent" runat="server" Text="Agent" meta:resourcekey="lblAgentResource1"></asp:Label>
                    </td>
                    <td style="vertical-align: top; text-align: left; width: 157px;" colspan="2">
                        <asp:TextBox ID="txtAgent" runat="server" CssClass="required" ReadOnly="True" meta:resourcekey="txtAgentResource1"
                            MaxLength="30"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtAgent"
                            Display="Dynamic" ErrorMessage="Agent is a required field." meta:resourcekey="RequiredFieldValidator1Resource1"></asp:RequiredFieldValidator>
                    </td>
                    <td style="vertical-align: top; width: 157px; text-align: left">
                    </td>
                </tr>
                <tr>
                    <td style="vertical-align: top; text-align: right; width: 137px; height: 34px;">
                        <asp:Label ID="lblName" runat="server" Text="Name" meta:resourcekey="lblNameResource1"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 191px; text-align: left; height: 34px;">
                        <asp:TextBox ID="txtName" runat="server" Width="244px" ReadOnly="True" meta:resourcekey="txtNameResource1"
                            MaxLength="100"></asp:TextBox>
                    </td>
                    <td style="vertical-align: top; width: 299px; text-align: right; height: 34px;">
                        <asp:Label ID="lblChiName" runat="server" Text="Chinese Name" meta:resourcekey="lblChiNameResource1"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 157px; text-align: left; height: 34px;">
                        <asp:TextBox ID="txtChiName" runat="server" Width="244px" ReadOnly="True" meta:resourcekey="txtChiNameResource1"
                            MaxLength="30"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="vertical-align: top; width: 137px; text-align: right">
                        <asp:Label ID="lblAddress" runat="server" Text="Address" meta:resourcekey="lblAddressResource1"></asp:Label>
                    </td>
                    <td colspan="3" style="vertical-align: top; width: 157px; text-align: left">
                        <asp:TextBox ID="txtAddress" runat="server" MaxLength="30" TextMode="MultiLine" Width="363px"
                            ReadOnly="True" meta:resourcekey="txtAddressResource1"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="vertical-align: top; width: 137px; text-align: right">
                        <asp:Label ID="lblWebSite" runat="server" Text="WebSite" meta:resourcekey="lblWebSiteResource1"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 191px; text-align: left">
                        <asp:TextBox ID="txtWebSite" runat="server" Width="239px" ReadOnly="True" meta:resourcekey="txtWebSiteResource1"
                            MaxLength="100"></asp:TextBox>
                    </td>
                    <td style="vertical-align: top; width: 299px; text-align: right">
                        <asp:Label ID="lblJobTitle" runat="server" Text="Job Title" meta:resourcekey="lblJobTitleResource1"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 157px; text-align: left">
                        <asp:TextBox ID="txtJobTitle" runat="server" Width="244px" ReadOnly="True" meta:resourcekey="txtJobTitleResource1"
                            MaxLength="60"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="vertical-align: top; width: 137px; text-align: right">
                        <asp:Label ID="lblContactPerson" runat="server" Text="Contact Person" meta:resourcekey="lblContactPersonResource1"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 191px; text-align: left">
                        <asp:TextBox ID="txtContactPerson" runat="server" Width="244px" ReadOnly="True" meta:resourcekey="txtContactPersonResource1"
                            MaxLength="30"></asp:TextBox>
                    </td>
                    <td style="vertical-align: top; width: 299px; text-align: right">
                        <asp:Label ID="lblContactPerson2" runat="server" Text="Contact Person 2" meta:resourcekey="lblContactPerson2"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 157px; text-align: left">
                        <asp:TextBox ID="txtContactPerson2" runat="server" Width="206px" ReadOnly="True"
                            meta:resourcekey="txtMobilePhoneResource1" MaxLength="30"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="vertical-align: top; width: 137px; text-align: right; height: 5px;">
                        <asp:Label ID="lblPhone" runat="server" Text="Phone Number" meta:resourcekey="lblPhoneResource1"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 191px; text-align: left; height: 5px;">
                        <asp:TextBox ID="txtPhone" runat="server" Width="206px" ReadOnly="True" meta:resourcekey="txtPhoneResource1"
                            MaxLength="30"></asp:TextBox>
                    </td>
                    <td style="vertical-align: top; width: 299px; text-align: right; height: 5px;">
                        &nbsp;<asp:Label ID="lblPhone2" runat="server" Text="Phone Number 2" meta:resourcekey="lblPhone2Resource1"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 157px; text-align: left; height: 5px;">
                        <asp:TextBox ID="txtPhone2" runat="server" Width="206px" ReadOnly="True" meta:resourcekey="txtPhone2Resource1"
                            MaxLength="30"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="vertical-align: top; width: 137px; text-align: right">
                        <asp:Label ID="lblFax" runat="server" Text="Fax Number 1" meta:resourcekey="lblFaxResource1"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 191px; text-align: left">
                        <asp:TextBox ID="txtFax" runat="server" Width="206px" ReadOnly="True" meta:resourcekey="txtFaxResource1"
                            MaxLength="30"></asp:TextBox>
                    </td>
                    <td style="vertical-align: top; width: 299px; text-align: right">
                        &nbsp;&nbsp;
                        <asp:Label ID="lblFax2" runat="server" Text="Fax Number 2" meta:resourcekey="lblFax2"
                            Width="39px"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 157px; text-align: left">
                        <asp:TextBox ID="txtFax2" runat="server" Width="206px" ReadOnly="True" meta:resourcekey="txtMobilePhone2Resource1"
                            MaxLength="30"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="vertical-align: top; width: 137px; text-align: right">
                        <asp:Label ID="lblEmailAddress" runat="server" Text="Email" meta:resourcekey="lblEmailAddressResource1"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 191px; text-align: left">
                        <asp:TextBox ID="txtEmailAddress" runat="server" Width="206px" ReadOnly="True" meta:resourcekey="txtEmailAddressResource1"
                            MaxLength="30"></asp:TextBox>
                    </td>
                    <td style="vertical-align: top; width: 299px; text-align: right">
                        <asp:Label ID="lblEmailAddress2" runat="server" Text="Email 2" meta:resourcekey="lblEmailAddress2Resource1"></asp:Label>
                    </td>
                    <td style="vertical-align: top; width: 157px; text-align: left">
                        <asp:TextBox ID="txtEmailAddress2" runat="server" Width="206px" ReadOnly="True" meta:resourcekey="txtEmailAddress2Resource1"
                            MaxLength="30"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" style="width: 100%; text-align: center">
                        <asp:Button ID="btnNew" runat="server" CssClass="submit" Text="New" OnClick="btnNew_Click"
                            CausesValidation="False" meta:resourcekey="btnNewResource1" />
                        <asp:Button ID="btnModify" runat="server" CssClass="submit" Text="Edit" OnClick="btnModify_Click"
                            CausesValidation="False" meta:resourcekey="btnModifyResource1" />
                        <asp:Button ID="btnSave" runat="server" CssClass="submit" Text="Save" OnClick="btnSave_Click"
                            meta:resourcekey="btnSaveResource1" />
                        <asp:Button ID="btnDelete" runat="server" CausesValidation="False" CssClass="submit"
                            OnClick="btnDelete_Click" Text="Delete" meta:resourcekey="btnDeleteResource1" />
                        <asp:Button ID="btnCancel" runat="server" CssClass="reset" Text="Cancel" OnClick="btnCancel_Click"
                            CausesValidation="False" meta:resourcekey="btnCancelResource1" />
                    </td>
                </tr>
            </table>
            <asp:CheckBox ID="chkForOperation" runat="server" Visible="False" meta:resourcekey="chkForOperationResource1" />
            <asp:CheckBox ID="cbForUpdate" runat="server" Height="2px" Visible="False" Width="121px"
                meta:resourcekey="cbForUpdateResource1" /></fieldset>
    </div>
</asp:Content>
